import Vue from 'vue'
import VueRouter from 'vue-router'

Vue.use(VueRouter)

const routes = [
    {
        path: '/',
        redirect: '/login'
    },
    {
        name: 'Login',
        path: '/login',
        component: () => import('@/views/Login')
    },
    {
        name: 'Main',
        path: '/main',
        component: () => import('@/views/Main'),
        children: [
            {
                path:'/',
                redirect:'checkInfo'
            },
            {
                name: 'CheckInfo',
                path: 'checkInfo',
                component: () => import('@/components/CheckInfo'),
                children: [
                    {
                        path: '/',
                        redirect: 'userList'
                    },
                    {
                        name: 'UserList',
                        path: 'userList',
                        component: () => import('@/components/CheckInfo/UserList')
                    },
                    {
                        name: 'RoleList',
                        path: 'roleList',
                        component: ()=> import('@/components/CheckInfo/RoleList')
                    },
                    {
                        name: 'PermissionsList',
                        path: 'permissionsList',
                        component: () => import('@/components/CheckInfo/PermissionsList')
                    }
                ]
            },
            {
                name: 'RoleManage',
                path: 'roleManage',
                component: () => import('@/components/RoleManage')
            },
            {
                name: 'AccountManage',
                path: 'accountManage',
                component: () => import('@/components/AccountManage')
            },
            {
                name: 'PermissionsManage',
                path: 'permissionsManage',
                component: () => import('@/components/PermissionsManage')
            }
        ]

    }
]

const router = new VueRouter({
    mode: 'history',
    base: process.env.BASE_URL,
    routes
})

export default router
